------------------------------------------------------------------------------------------------------------------------------------
      name:  plog_880
       log:  /accounts/projects/jr_ra/GRscarring/erratum/programs/analysis/fig_eduageyear.log
  log type:  text
 opened on:  27 Nov 2024, 17:58:54

. ***************************************************************************************************************
. * fig_eduageyear.do
. * outcome is share of people in the cohort who are college grads, in each year and at each age.
. *
. * Edit: 
. * 4/10/18, JR: Reorganized to use same code for BA as for some college
. * 4/16/18, JR: Minor edits to fix recession shading issue.
. * 01/20/2020: NG:  Update to match with the new cohort and birthcohort variables 
. *************************************************************************************************************** 
. 
. clear

. cap project, doinfo

. *cap err
. if _rc==0 {
.         local pdir "`r(pdir)'"                                                      // the project's main dir.
.         local dofile "`r(dofile)'"                                                  // do-file's stub name
.         local sig {bind:{hi:[`dofile'.dta. RP : `dofile'.do, `c(current_date)']}}       // a signature in notes
.         local doasproject=1
. }

. else {
.         local pdir "~/GRscarring"
.         local dofile "fig_eduageyear"
.         local doasproject=0
. }

. 
. set more off

. local rootdir "`pdir'"

. local thisdir "`pdir'" 

. 
. local scratch "`pdir'/scratch"

. local rawdata "`pdir'/rawdata"

. local output "`pdir'/results"

. 
. if `doasproject'==1 {
.         project, uses("`scratch'/combinecollapse_yc.dta")
project GRscar_erratum > do-file uses: "/scratch/public/jr_ra/GRscarring2024/erratum/scratch/combinecollapse_yc.dta" filesig(4188613
> 019:1425400)
. }

. 
. set scheme s1color

. 
. use `scratch'/combinecollapse_yc, clear

. 
. 
. keep if age>=22 & age<=40 
(1,971 observations deleted)

. isid birthcohort year 

. *drop if year>=2018
. 
. gen year22=birthcohort+22

. *Group adjacent cohorts
. gen year22_even=floor(year22/2)*2

. keep if year22==year22_even   
(399 observations deleted)

. 
. gen collegegrad=ed_ba + ed_grad
(10 missing values generated)

. gen collegesome=ed_scol + ed_ba + ed_grad
(10 missing values generated)

. replace collegesome=0 if collegesome==.
(10 real changes made)

. collapse (mean) collegegrad collegesome (min) age [aw=bigcpswgt], by(year22_even year)

. replace collegegrad=collegegrad*100 
(389 real changes made)

. replace collegesome=collegesome*100 
(389 real changes made)

. 
. forvalues y=1980(2)2016 {
  2.   gen ba_cohort`y'=collegegrad if year22_even==`y'
  3.   gen sc_cohort`y'=collegesome if year22_even==`y'
  4. }
(370 missing values generated)
(370 missing values generated)
(370 missing values generated)
(370 missing values generated)
(370 missing values generated)
(370 missing values generated)
(370 missing values generated)
(370 missing values generated)
(370 missing values generated)
(370 missing values generated)
(370 missing values generated)
(370 missing values generated)
(370 missing values generated)
(370 missing values generated)
(370 missing values generated)
(370 missing values generated)
(370 missing values generated)
(370 missing values generated)
(370 missing values generated)
(370 missing values generated)
(370 missing values generated)
(370 missing values generated)
(371 missing values generated)
(371 missing values generated)
(373 missing values generated)
(373 missing values generated)
(375 missing values generated)
(375 missing values generated)
(377 missing values generated)
(377 missing values generated)
(379 missing values generated)
(379 missing values generated)
(381 missing values generated)
(381 missing values generated)
(383 missing values generated)
(383 missing values generated)
(385 missing values generated)
(385 missing values generated)

. 
. 
. twoway line  ba_cohort* year if age<=30, lstyle(p1 p2 p3 p4 p1 p2 p3 p4 p1 p2 p3 p4 p1 p2 p3 p4 p1 p2 p3) ///
>                                          lcolor(gray gray gray gray gray gray gray gray gray gray gray gray gray gray gray gray gr
> ay gray gray) ///
>                                          lpattern(shortdash shortdash shortdash shortdash shortdash shortdash shortdash shortdash 
> shortdash shortdash shortdash shortdash shortdash shortdash shortdash shortdash shortdash shortdash shortdash )|| ///
> scatter collegegrad year if age==30 & year22_even>=1980, mstyle(p1 ) lstyle(p1) ///
>         msize(small) connect(l) || ///
> scatter collegegrad year if age==24 & year22_even>=1980, mstyle(p2) lstyle(p2) ///
>         msize(small) msymbol(Th)  connect(l)  || ///
> scatter collegegrad year if age==22 & year22_even>=1980, mstyle(p3) lstyle(p3) ///
>          msymbol(X) connect(l) || ///
>   , legend(order(22 "Age 22"  21 "Age 24" 20 "Age 30") cols(3)) ///
>     xtitle("Year") ytitle("Percent with BA") ///
>     saving("`output'/`dofile'_college.gph", replace)
file /accounts/projects/jr_ra/GRscarring/erratum/results/fig_eduageyear_college.gph saved

. 
. twoway line  sc_cohort* year if age<=30, lstyle(p1 p2 p3 p4 p1 p2 p3 p4 p1 p2 p3 p4 p1 p2 p3 p4 p1 p2 p3) ///
>                                          lcolor(gray gray gray gray gray gray gray gray gray gray gray gray gray gray gray gray gr
> ay gray gray) ///
>                                          lpattern(shortdash shortdash shortdash shortdash shortdash shortdash shortdash shortdash 
> shortdash shortdash shortdash shortdash shortdash shortdash shortdash shortdash shortdash shortdash shortdash )|| ///
> scatter collegesome year if age==30 & year22_even>=1980, mstyle(p1 ) lstyle(p1) ///
>         msize(small) connect(l) || ///
> scatter collegesome year if age==24 & year22_even>=1980, mstyle(p2) lstyle(p2) ///
>         msize(small) msymbol(Th)  connect(l)  || ///
> scatter collegesome year if age==22 & year22_even>=1980, mstyle(p3) lstyle(p3) ///
>          msymbol(X) connect(l) || ///
>   , legend(order(22 "Age 22"  21 "Age 24" 20 "Age 30") cols(3)) ///
>     xtitle("Year") ytitle("Percent with some college") ///
>     saving("`output'/`dofile'_somecollege.gph", replace)
file /accounts/projects/jr_ra/GRscarring/erratum/results/fig_eduageyear_somecollege.gph saved

. 
. 
. if `doasproject'==1 {
.         project, creates(`output'/`dofile'_college.gph)
project GRscar_erratum > do-file creates: "results/fig_eduageyear_college.gph" filesig(119711715:57793)
.         project, creates(`output'/`dofile'_somecollege.gph)
project GRscar_erratum > do-file creates: "results/fig_eduageyear_somecollege.gph" filesig(615335641:57824)
. }

.  
. 
. 
. 
. 
end of do-file
      name:  plog_880
       log:  /accounts/projects/jr_ra/GRscarring/erratum/programs/analysis/fig_eduageyear.log
  log type:  text
 closed on:  27 Nov 2024, 17:58:56
------------------------------------------------------------------------------------------------------------------------------------
